package com.soft.collateral.exception;

import com.soft.collateral.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/7/24
 */
@RestControllerAdvice
public class CustomExceptionHandler {

    @ExceptionHandler(AccessTokenInvalidException.class)
    public Result handler1(AccessTokenInvalidException ex){
        return new Result(false, ex.getMessage());
    }

    @ExceptionHandler(RefreshTokenInvalidException.class)
    public Result handler2(RefreshTokenInvalidException ex){
        return new Result(false, ex.getMessage());
    }

    @ExceptionHandler(CollateralException.class)
    public Result handler3(CollateralException ex){
        return new Result(false, ex.getMessage());
    }
}
